package com.yeyks.consumer.dal.dao;

import com.yeyks.consumer.dal.domain.UserCouponInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeyks.consumer.dto.BigGiftCouponListDTO;
import com.yeyks.consumer.dto.UserCouponResult;
import com.yeyks.consumer.dto.UserCouponResultDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;


/**
 * <p>
 * 领取券表 Mapper 接口
 * </p>
 *
 * @author yun
 * @since 2019-06-25
 */
public interface UserCouponInfoMapper extends BaseMapper<UserCouponInfo> {
    int insertReturnId(UserCouponInfo record);

    int countOfUserIdCouponId(UserCouponInfo info);

    int countOfUserIdCouponId(@Param("userId") Integer userId, @Param("couponId") Integer couponId);

    List<Map> selectValid(@Param("couponId") Integer couponId, @Param("hotelId") Integer hotelId);

    int deleteByCouponId(@Param("couponId") Integer couponId);

    List<UserCouponInfo> selectUnusedByCouponId(@Param("couponId") Integer couponId);

    int updateUsedStatus(@Param("couponId") Integer couponId, @Param("useStatus") Integer useStatus);

    Long selectUserCouponListCount(Map<String, Object> map);

    Long selectUserCouponListCountV2(Map<String, Object> map);

    Integer updateCouponUseById(@Param("userCouponId") Integer userCouponId, @Param("orderNO") String orderNO, @Param("use") Boolean use);

    UserCouponInfo selectUserCoupon(@Param("couponId") Integer couponId, @Param("userId") Integer userId);

    int deleteByPrimaryKey(Integer id);

    UserCouponInfo selectByPrimaryKey(Integer id);

    List<UserCouponInfo> selectAll();

    int updateByPrimaryKey(UserCouponInfo record);

    List<UserCouponResult> selectUserCouponList(Map<String, Object> map);

    List<UserCouponResultDTO> selectUserCouponListV2(Map<String, Object> map);

    Integer updateCouponUseById2(@Param("userCouponId") Integer userCouponId, @Param("use") Integer use);

    UserCouponInfo selectByNewest(Integer userId);

    List<BigGiftCouponListDTO> bigGiftCouponList(@Param("userId") Integer userId, @Param("orderNo") String orderNo);

}
